package service

import "gitee.com/gopher2011/mall/app/dao"

// 全局公开对象
var SmsHomeRecommendSubject = smsHomeRecommendSubjectService{}

// 私有对象，所有的方法都绑定到这个结构体上。

type smsHomeRecommendSubjectService struct{}

func (p *smsHomeRecommendSubjectService) Create(arg dao.SmsHomeRecommendSubjectReq) (int64, error) {
	return dao.SmsHomeRecommendSubjectDao.InsertTemplate(arg.List)
}

func (p *smsHomeRecommendSubjectService) UpdateSort(id, sort int) (int64, error) {
	return dao.SmsHomeRecommendSubjectDao.UpdateSort(id, sort)
}

func (p *smsHomeRecommendSubjectService) Delete(ids []int) (int64, error) {
	return dao.SmsHomeRecommendSubjectDao.Delete(ids)
}

func (p *smsHomeRecommendSubjectService) UpdateRecommendStatus(ids []int, recommendStatus int) (int64, error) {
	return dao.SmsHomeRecommendSubjectDao.UpdateRecommendStatus(ids, recommendStatus)
}

func (p *smsHomeRecommendSubjectService) List(arg dao.SmsHomeRecommendSubjectList) ([]dao.SmsHomeRecommendSubject, error) {
	arg.PageNum = (arg.PageNum - 1) * arg.PageSize
	return dao.SmsHomeRecommendSubjectDao.List(arg)
}
